package cn.gcBlock.service.mapper;

import cn.hutool.core.bean.BeanUtil;
import cn.gcBlock.po.DigOre;
import cn.gcBlock.dto.DigOreDTO;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class DigOreMapperImpl implements DigOreMapper {

    @Override
    public DigOre toEntity(DigOreDTO arg0) {
        if (arg0 == null) {
            return null;
        }
        DigOre DigOre = new DigOre();
        BeanUtil.copyProperties(arg0, DigOre);
        return DigOre;
    }

    @Override
    public DigOreDTO toDto(DigOre arg0) {
        if (arg0 == null) {
            return null;
        }
        DigOreDTO DigOre = new DigOreDTO();
        BeanUtil.copyProperties(arg0, DigOre);
        return DigOre;
    }

    @Override
    public List<DigOre> toEntity(List<DigOreDTO> arg0) {
        if (arg0 == null) {
            return null;
        }

        List<DigOre> list = new ArrayList<DigOre>(arg0.size());
        for (DigOreDTO documentDTO : arg0) {
            list.add(toEntity(documentDTO));
        }

        return list;
    }

    @Override
    public List<DigOreDTO> toDto(List<DigOre> arg0) {
        if (arg0 == null) {
            return null;
        }

        List<DigOreDTO> list = new ArrayList<DigOreDTO>(arg0.size());
        for (DigOre document : arg0) {
            list.add(toDto(document));
        }

        return list;
    }
}
